﻿@using System.Threading;
@using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Helpers
@using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.Security
@using GlobalResources
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="icon" href="~/Content/favicon.ico" type="image/x-icon" />
    <title>IoT Device Portal - @ViewBag.Title</title>
    <script type="text/javascript">
        var cultureInfo = '@Culture';
        var cultureInfoShort = '@Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName'

        var baseLayoutResources = {
            commandCToCopy: '@Html.JavaScriptString(Strings.CommandCToCopy)',
            controlCToCopy: '@Html.JavaScriptString(Strings.ControlCToCopy)',
            clickToSelectAll: '@Html.JavaScriptString(Strings.ClickToSelectAll)'
        };
    </script>
    @Scripts.Render("~/bundles/powerbi-visuals")
    @Scripts.Render("~/bundles/bootstrap")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/jquerytable")
    @Scripts.Render("~/bundles/jqueryui")
    @Scripts.Render("~/bundles/knockout")
    <script src="~/Scripts/moment-with-locales.min.js"></script>
    @Scripts.Render("~/bundles/bootstrapdatetime")

    <script type="text/javascript" src="~/Scripts/js.cookie-1.5.1.min.js"></script>
    <script type="text/javascript" src="~/Scripts/Views/IoTApp.js?ver=@Constants.JSVersion"></script>
    @Styles.Render("~/Content/css/vendor")
    @Styles.Render("~/Content/css")
</head>
<body>
    <header>
        <div class="navbar navbar-inverse">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">@Strings.MicrosoftAzureIoTSuite - @Strings.DefaultSolutionName</a>
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#accountMenu">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>
                <div id="accountMenu" class="collapse navbar-collapse">
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                <span class="language-icon"></span>
                            </a>
                            <ul class="dropdown-menu" role="menu" aria-labelledby="account-menu">
                                @foreach (var language in CultureHelper.GetLanguages())
                                {
                                    if (language.IsCurrent)
                                    {
                                        <li role="presentation" class="active">
                                            <a>@language.Name</a>
                                        </li>
                                    }
                                    else
                                    {
                                        <li role="presentation">
                                            <a href="@Url.Action("SetCulture", "Culture", new { cultureName = language.CultureName })">@language.Name</a>
                                        </li>
                                    }
                                }
                            </ul>
                        </li>
                        <li class="dropdown account-dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                <span class="account-avatar"></span>
                                <span class="account">
                                    <span class="account-name">@PrincipalHelper.GetEmailAddress(User)</span>
                                    @if (User.IsInRole("Admin"))
                                    {
                                        <span class="account-subtitle">@Strings.AdministratorRole</span>
                                    }
                                    else if (User.IsInRole("ReadOnly"))
                                    {
                                        <span class="account-subtitle">@Strings.ReadOnlyRole</span>
                                    }
                                    else
                                    {
                                        <span class="account-subtitle">@Strings.ImplicitReadOnlyRole</span>
                                    }
                                </span>
                            </a>
                            <ul class="dropdown-menu account-menu" role="menu" aria-labelledby="account-menu">
                                <li role="presentation">
                                    <a href="@Url.Action("SignOut", "Account")" role="menuitem">@Strings.SignOut</a>
                                </li>
                                <li role="separator" class="divider"></li>
                                <li role="presentation">
                                    <a href="https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade" target="_blank" role="menuitem">@Strings.LinkLabelHelpAndSupport</a>
                                </li>
                                <li role="presentation">
                                    <a href="http://feedback.azure.com/forums/321918-azure-iot" target="_blank" role="menuitem">@Strings.LinkLabelHelpGiveFeedback</a>
                                </li>
                            </ul>
                        </li>
                    </ul>

                </div>
            </div>
        </div>
    </header>
    <section class="page">

        @RenderSection("Navigation", required: false)

        @RenderSection("Main", required: true)

        <div id="loadingElement" class="loader_container">
            <div class="loader_container__loader"></div>
        </div>

    </section>

    @Html.Partial("_Dialogs")
    <script src="~/Scripts/IoTHelperScripts.js?ver=@Constants.JSVersion"></script>
    <script src="~/Scripts/dialog.js?ver=@Constants.JSVersion"></script>
    <script src="~/Scripts/controls.js?ver=@Constants.JSVersion"></script>
    @RenderSection("scripts", required: false)


</body>
</html>
